import dvarequest from '../utils/dvarequest'
import { PAGE_SIZE } from '../constants'
import { config } from 'utils'

const { api } = config
const { processType } = api
export function fetch ({ page }) {
  return dvarequest(`${processType}`, {
    method: 'POST',
    body: JSON.stringify({ page }),
  })
}

export function remove (id) {
  return dvarequest(`${processType}/${id}`, {
    method: 'DELETE',
  })
}

export function patch (id, values) {
  return dvarequest(`${processType}/${id}`, {
    method: 'PUT',
    body: JSON.stringify(values),
  })
}

export function create (values) {
  return dvarequest(`${processType}/add`, {
    method: 'POST',
    body: JSON.stringify(values),
  })
}

export function getById (id) {
  return dvarequest(`${processType}/${id}`, {
    method: 'GET',
  })
}
export function processTypeBySystemSelect (systemCode) {
  return dvarequest(`${processType}/system-code/${systemCode}`, {
    method: 'GET',
  })
}
export function listNoPage (values) {
  return dvarequest(`${processType}/listNoPage`, {
    method: 'POST',
    body: JSON.stringify(values),
  })
}
